package com.guard.agent.bridge;

import java.net.MalformedURLException;
import java.util.concurrent.ConcurrentHashMap;

public class PluginClassLoaderFactory {

    private static volatile ConcurrentHashMap<ClassLoader, PluginClassLoader> LOADER = new ConcurrentHashMap<>();

    public static PluginClassLoader get(ClassLoader parent) throws MalformedURLException {
        /*PluginClassLoader classLoader = LOADER.get(parent);
        if (classLoader == null) {
            classLoader = new PluginClassLoader(parent);
            LOADER.put(parent, classLoader);
        }
        return classLoader;*/
        return LOADER.computeIfAbsent(parent, p -> new PluginClassLoader(p));
    }

}
